package cn.itsource.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class SessionController {

    @GetMapping("/getSession1")
    public void getSession1(HttpSession session){
        session.setAttribute("username",333333);

    }

    @GetMapping("/getSession2")
    public void getSession2(HttpSession session){
        Object username = session.getAttribute("username");
        System.out.println("2:"+username);

    }
    @GetMapping("/getSession3")
    public void getSession(HttpSession session){
        Object username = session.getAttribute("username");
        System.out.println("3:"+username);

    }
}
